/*
 * Powered By dico
 * Since 2017 - 2018
 */package com.seeyoui.kensite.bussiness.orderlang.specification.service;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.seeyoui.kensite.common.base.service.BaseService;

import java.util.*;

import com.seeyoui.kensite.common.base.domain.EasyUIDataGrid;
import com.seeyoui.kensite.common.base.service.BaseService;
import com.seeyoui.kensite.common.exception.CRUDException;
import com.seeyoui.kensite.common.util.*;
import com.seeyoui.kensite.common.constants.StringConstant;
import com.seeyoui.kensite.bussiness.orderlang.specification.domain.Specification;
import com.seeyoui.kensite.bussiness.orderlang.specification.persistence.SpecificationMapper;

/**
 * Specification
 * @author dico
 * @version 2.0
 * @since 1.0
 * @date 2018-02-24
 */

@Service
public class SpecificationService extends BaseService {
	
	@Autowired
	private SpecificationMapper specificationMapper;

	/**
	 * 根据ID查询单条数据
	 * @param id
	 * @return
	 * @throws CRUDException
	 */
	public Specification findOne(String id) throws CRUDException{
		return specificationMapper.findOne(id);
	}
	
	/**
	 * 查询数据集合
	 * @param specification
	 * @return
	 * @throws CRUDException
	 */
	public List<Specification> findList(Specification specification) throws CRUDException {
		return specificationMapper.findList(specification);
	}
	
	/**
	 * 查询所有数据集合
	 * @param specification
	 * @return
	 * @throws CRUDException
	 */
	public List<Specification> findAll(Specification specification) throws CRUDException {
		return specificationMapper.findAll(specification);
	}
	
	/**
	 * 查询数据总数
	 * @param specification
	 * @return
	 * @throws CRUDException
	 */
	public int findTotal(Specification specification) throws CRUDException {
		return specificationMapper.findTotal(specification);
	}
	
	/**
	 * 查询数据总数排除当前数据
	 * @param specification
	 * @return
	 * @throws CRUDException
	 */
	public int findExTotal(Specification specification) throws CRUDException {
		return specificationMapper.findExTotal(specification);
	}
	
	/**
	 * 数据新增
	 * @param specification
	 * @throws CRUDException
	 */
	public void save(Specification specification) throws CRUDException{
		specification.preInsert();
		specificationMapper.save(specification);
	}
	
	/**
	 * 数据修改
	 * @param specification
	 * @throws CRUDException
	 */
	public void update(Specification specification) throws CRUDException{
		specification.preUpdate();
		specificationMapper.update(specification);			
	}
	
	/**
	 * 数据删除
	 * @param listId
	 * @throws CRUDException
	 */
	public void delete(List<String> listId) throws CRUDException {
		specificationMapper.delete(listId);
	}
	
	/**
	 * 数据假删除
	 * @param specification
	 * @throws CRUDException
	 */
	public void remove(Specification specification) throws CRUDException{
		specification.preUpdate();
		specificationMapper.remove(specification);			
	}
	
}